package com.hdu.hot100.binarySearch;

public class lc74 {
    class Solution {
        public boolean searchMatrix(int[][] matrix, int target) {
            int curX = 0;
            int curY = matrix[0].length - 1;
            while (curX < matrix.length && curY >= 0) {
                if (matrix[curX][curY] == target) {
                    return true;
                } else if (matrix[curX][curY] > target) {
                    curY--;
                } else {
                    curX++;
                }
            }
            return false;
        }
    }
}
